#include "BaseInc.h"
#include "Utility.h"
#include "TString.h"
TString::TString()
{

}

TString::TString(const char* str)
{
	wstr_data = Utility::ConvertToWstring(str);
}

TString::TString(const wchar_t* str)
{
	wstr_data = str;
}

TString::TString(std::string str)
{
	wstr_data = Utility::ConvertToWstring(str);
}

TString::TString(std::wstring str)
{
	wstr_data = str;
}

std::string TString::GetString()
{
	return Utility::ConvertTostring(wstr_data);
}

std::wstring TString::GetWString()
{
	return wstr_data;
}
#ifdef _UNICODE
const wchar_t* TString::data()
{
	return wstrdata();
}
#else
const char* TString::data()
{
	return strdata();
}
#endif


const wchar_t* TString::wstrdata()
{
	return wstr_data.data();
}

const char* TString::strdata()
{
	return Utility::ConvertTostring(wstr_data).data();
}

size_t TString::size()
{
	return	wstr_data.size();
}

void TString::operator=(const wchar_t* wstr)
{
	wstr_data = wstr;
}

void TString::operator=(const char* str)
{
	wstr_data = Utility::ConvertToWstring(str);
}

void TString::operator=(std::string str)
{
	wstr_data = Utility::ConvertToWstring(str);
}

void TString::operator=(std::wstring wstr)
{
	wstr_data = wstr;
}

TString TString::operator+(std::wstring wstr)
{
	TString tstr;
	tstr.wstr_data = wstr_data + wstr;
	return	tstr;
}
TString TString::operator+(std::string str)
{
	TString tstr;
	tstr.wstr_data = wstr_data + Utility::ConvertToWstring(str);
	return	tstr;
}

TString TString::operator+=(std::string str)
{
	wstr_data += Utility::ConvertToWstring(str);
	return	*this;
}

TString TString::operator+=(std::wstring data)
{
	wstr_data += data;
	return	*this;
}
